package pulpfizz.pulp.ui;

import pulpcore.sprite.Label;
import pulpcore.image.CoreGraphics;
import pulpcore.image.CoreImage;
import pulpcore.image.Colors;
import pulpcore.math.CoreMath;

/**
 * Simple label that draws a white background behind the text.
 * Created by will
 * Date: Apr 27, 2008 2:21:48 AM
 */
public class LabelBox extends Label {

    public LabelBox(String text, int x, int y) {
        super(text, x, y);
    }

    protected void drawSprite(CoreGraphics g) {
        g.setColor(Colors.WHITE);
        g.fillRect(0,0,width.getAsInt(),height.getAsInt());
        String displayText = this.getText();
        String currDisplayText = displayText;
        if (numDisplayChars.get() < displayText.length()) {
            currDisplayText = displayText.substring(0, numDisplayChars.get());
        }
        drawText(g, currDisplayText);
    }
}
